<?php

namespace App\Http\Controllers\OpenShop\Merchant;

use App\Enums\OpenShop\InvestmentPromotion\SignOrderEnum;
use App\Http\Controllers\BaseController;
use App\Models\OpenShop\InvestmentPromotion\OpenShopMainProcessModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderModel;
use App\Service\OpenShop\Feishu\ConfigService;
use App\Service\System\SystemNoticeService;
use Illuminate\Http\Request;

class ConfigController extends BaseController
{
    // 系统配置接口
    public function configInfo(Request $request)
    {
        $param      = $request->get('param', 'default');
        $configList = ConfigService::config('openShop');
        return $this->success([
            $param => $configList[$param] ?? null
        ]);
    }

    /**
     * app的入口权限
     * @param Request $request
     * @param int $shopId
     */
    public function appEntrance(Request $request, int $shopId)
    {
        $request->merge(['shopId' => $shopId]);

        $this->validate($request, [
            'shopId' => 'required|integer|min:1',
        ]);

        return $this->success(ConfigService::appEntrance($shopId));
    }
}
